﻿using System;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.Common;

namespace NUnitForVSTS.NUnitTest
{
    /// <summary>
    /// General class for extention methods
    /// </summary>
	static class Extensions
	{
        /// <summary>
        /// Sets the test onto a testresult.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <param name="test">The test.</param>
		public static void SetTest(this TestResultMessage result, ITestElement test)
		{
			PropertyInfo testProperty = result.GetType().GetProperty("Test");
			testProperty.SetValue(result, test, null);
		}
	}
}
